TreeGrid Paging Tutorial
5. Adding pages dynamically
Adding new root pages and column pages on demand on client side
-
Adding root pages
dynamically by API.
Must be set Paging='2' or '3'.
The new root page can be created and added to the end of grid by AddPage
method.
You need to put the method the row data in XML, like in page response.
Remember, individual rows, not pages, can be added by AddRow method.
-
Adding column pages
dynamically by API.
Must be set ColPaging='2'.
The new column page can be created and added to the right of variable columns (middle section) in grid by AddColPage
method.
To this method you fill only the column names, not any any data.
Remember, individual columns, not pages, can be added by AddCol method.
-
To add the pages on scroll to the bottom or right, use
OnScroll
event.
Here you can use API methods like GetBodyWidth, GetBodyScrollWidth and GetBodyHeight, GetBodyScrollHeight to find if the grid is scrolled to the edge.
-
Optionally you can set Cfg attribute EnterMode to specify behavior of Enter key, set it to 1 to behave like in Excel - enter goes cell down.
-
Adding child pages
dynamically by API
To add new child pages on row expand you need to switch to server child paging by Cfg attribute ChildPaging='3'
And to all rows where you want to add children set attribute Count
='1' and Expanded='0'.
The new child page create in API event OnDownloadPage
, here call AddDataFromServer
with children data to add them.